home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_beam.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  284 lines

  1.  # Jones 3D Cog Script
  2. #
  3. # shs_Beam.cog     Make the beam break and fall.  
  4. #
  5. # [JWC, RKD, TM]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. message     entered
  14. message     startup
  15. message        arrived
  16. message        exited
  17. message        touched
  18. message        pulse
  19.  
  20. keyframe    smashed=in_die_buckle.key            local
  21.  
  22. material    mat1=gen_a4sfx_splash.mat             local
  23. material    mat2=gen_a4sfx_splash.mat            local
  24.  
  25. sound        sndBeam=shs_beam_c.wav               local
  26. sound        sndDie=tem_temspikes_up_kill_c.wav    local
  27. sound        sndSplash=sea_launch_splash_c.wav      local
  28. sound        ambient0=shs_creaky_a1.wav           local
  29. sound        ambient1=shs_creaky_a2.wav           local
  30. sound        ambient2=shs_creaky_a3.wav           local
  31. sound        ambient3=shs_creaky_a4.wav           local
  32. sound          in_danger=Inxj045.wav                local # Danger!    
  33.  
  34. template    splashTpl=splshboat                      local
  35.  
  36. thing        beam                                             
  37. thing        beam1                               linkid=2
  38. thing        beam2                               linkid=2
  39. thing        cam1
  40. thing        c1_t1
  41. thing        player                                 local
  42. thing        splash0                                local
  43. thing        ghost0        
  44. thing        lowerbeams0                             linkid=1
  45. thing        lowerbeams1                            linkid=1
  46. thing        lowerbeams2                            linkid=1
  47.  
  48. vector        posOffset                            local
  49. vector        angOffset                            local
  50.  
  51.  
  52. int         fell=0                                  local
  53. int         broken=0                              local
  54. int         onbeam=0                             local
  55. int            killable=0                            local
  56. int            curCam                                local
  57. int            warning=0                            local
  58. int            shake=0                                local
  59. int            vibe=0                                local
  60.  
  61.  
  62. #SUB-ROUTINES
  63. flex        fall                                local
  64. flex        kill                                local
  65.  
  66. end
  67.  
  68. # ========================================================================================
  69.  
  70. code
  71.  
  72. startup:
  73.     
  74.     player = GetLocalPlayerThing();
  75.     curCam = GetCurrentCamera();
  76.     return;
  77.  
  78.     
  79. entered:
  80.     
  81.     # Indy is on broken beam
  82.     if (GetSenderRef() == beam)     
  83.     {
  84.         onbeam=1;
  85.         
  86.         # beam breaks just once
  87.         if (broken == 0)
  88.         {
  89.             broken=1;
  90.             killable=1;            # kills indy if he hits other beams
  91.             Rotate(beam, 5, 2, .5);
  92.     
  93.             # break sound
  94.             PlaySoundLocal(sndBeam, 1.0, 0.0, 0x0, 0);
  95.             
  96.             # camera shake
  97.             SetPulse(.1);
  98.             sleep(.5);
  99.             SetPulse(0.0);
  100.             shake=1;
  101.             SetPulse(2.0);
  102.             return;
  103.         }
  104.         
  105.         # Indy is on the beam again, kill him
  106.         if ((broken == 1) && (fell == 0))
  107.         {
  108.             MakeMeStop();
  109.             call fall;
  110.         }
  111.     
  112.     }
  113.     
  114.     # Indy is safe and beam broken
  115.     if (GetSenderId() == 2) 
  116.     {
  117.         if (warning == 0)
  118.         {
  119.             warning=1;
  120.             # "Danger!"
  121.             sleep(.25);
  122.             PlayVoice(player, in_danger, 1.0, 1);
  123.         }
  124.         
  125.         if ((broken == 1) && (fell != 1))
  126.         {
  127.             call fall;
  128.         }
  129.  
  130.     }
  131.  
  132.     return;
  133.   
  134.  
  135. exited:
  136.     
  137.     if (GetSenderRef() == beam) 
  138.     {
  139.         onbeam=0;
  140.     }
  141.     return;
  142.     
  143. arrived:
  144.     
  145.     if ((GetCurFrame(beam) == 1) && (GetSenderRef() == beam) && (onbeam ==1))
  146.     {
  147.         call kill;
  148.     }
  149.     return;
  150.  
  151. touched:
  152.  
  153.     if ((killable == 1) && (GetSenderId() == 1))
  154.     {
  155.         call kill;
  156.     }
  157.     return;
  158.  
  159. # ========================================================================================
  160.             
  161. pulse:
  162.     if (shake == 0 )
  163.     {
  164.         vibe = RandBetween(1, 4);
  165.         if (vibe == 1)
  166.         {
  167.             posOffset = '-0.008 0.00 -0.002'; #1 was .005x
  168.             angOffset = '0.00 -0.002 0.002';
  169.         }
  170.     
  171.         if (vibe == 2)
  172.         {
  173.             posOffset = '0.008 -0.005 0.002'; #2 was .005x
  174.             angOffset = '0.002 0.00 -0.002';
  175.         }
  176.     
  177.         if (vibe == 3)
  178.         {
  179.             posOffset = '0.005 0.005 -0.005'; #3 was .002x
  180.             angOffset = '-0.002 0.005 -0.005';
  181.         }
  182.     
  183.         if (vibe == 4)
  184.         {
  185.             posOffset = '-0.002 0.00 0.005'; #4
  186.             angOffset = '0.00 0.00 0.002';
  187.         }
  188.         
  189.         vibe = RandBetween(1, 3);
  190.         if (vibe == 1)
  191.         {
  192.             SetPulse(0.05);
  193.         }
  194.         if (vibe == 2)
  195.         {
  196.             SetPulse(0.1);
  197.         }
  198.         if (vibe == 3)
  199.         {
  200.             SetPulse(0.15);
  201.         }
  202.  
  203.         SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  204.  
  205.     }
  206.     else
  207.     {
  208.         PlaySoundThing(ambient0[RandBetween(0, 3)], beam, 1, 5, 9, 0);
  209.     }
  210.     
  211.     return;
  212.             
  213. # ========================================================================================
  214.     
  215.  
  216. fall:
  217.     
  218.     fell=1;        
  219.     
  220.     # stop creaky sound
  221.     setpulse (0.0);
  222.     
  223.     # seize control
  224.     SetActorFlags(player, 0x200000);
  225.     StartCutscene(0);
  226.     StopThing(player);
  227.     AttachThingToThing(c1_t1, beam);
  228.     Sleep(1);
  229.     #DetachThing(player);
  230.  
  231.     # cut to watch fall
  232.     SetCameraFocus(2, cam1);
  233.     SetCameraSecondaryFocus(2, c1_t1);
  234.     sleep(.01);
  235.     SetCurrentCamera(2);
  236.     SetCameraFOV(40, 0, 0);
  237.     
  238.     PlaySoundLocal(sndBeam, 1.0, 0.0, 0x0, 0);
  239.     MoveToFrame(beam, 1, 5.0);
  240.     sleep(.5);
  241.     MoveToFrame(beam, 1, 8.0);
  242.     sleep(.5);
  243.        MoveToFrame(beam, 1, 12.0);
  244.     WaitForStop(beam);
  245.     
  246.     # play splash
  247.     splash0 = CreateThing(splashTpl, ghost0);
  248.     MaterialAnim(mat1, 16, 0x0);
  249.     MaterialAnim(mat2, 16, 0x0);
  250.     PlaySoundLocal(sndSplash, 1.0, 0.0, 0x0, 0);
  251.     SetLifeLeft(splash0, 0.5);
  252.         
  253.     sleep(1);
  254.     
  255.     # return control
  256.     SetCameraLookInterp(2, 0); # kill pan & tilt mode
  257.     SetCameraPosInterp(2, 0); # kill dolly mode
  258.     Sleep(0.01);
  259.     SetCurrentCamera(1);
  260.     ResetCameraFOV(0, 0.0);                 
  261.     EndCutscene();
  262.     ClearActorFlags(player, 0x200000);
  263.     killable=0;    
  264.     return;
  265.  
  266. kill:
  267.  
  268.     # kill player
  269.     PlayKey(player, smashed, 10, 0x14, 0);
  270.     PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  271.     DamageThing(player, 1000, 0x80, beam);
  272.     DamageThing(player, 1000, 0x80, lowerbeams0);
  273.     DamageThing(player, 1000, 0x80, lowerbeams1);
  274.     DamageThing(player, 1000, 0x80, lowerbeams2);
  275.     return;
  276.  
  277. end
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.